package com.supkong.java.predicate;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;

/**
 * @program: jdk8-learning-example
 * @author: Kong
 * @create: 2020-04-09 16:26
 * @description:
 */
public class AppUtils {
    public static <T> List<T> filterApples(List<T> apples, Predicate<T> p) {
        List<T> result = new ArrayList<>();
        for (T t:apples){
            if(p.test(t)){
                result.add(t);
            }
        }
        return result;
    }
}
